<template>
  <div>
    <!--查看和-->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="90px">

        <el-form-item label="请请假类型" prop="leaveType">
          <el-select v-model="form.leaveType" placeholder="请选择">
            <el-option
              v-for="item in leaveTYpeOptions"
              :key="item.value"
              :label="item.dictLabel"
              :value="item.dictValue">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始时间" prop="leaveStartTime">
          <el-date-picker
            v-model="form.leaveStartTime"
            type="datetime"
            placeholder="选择日期时间"
           >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间" prop="leaveEndTime">
          <el-date-picker
            v-model="form.leaveEndTime"
            type="datetime"
            placeholder="选择日期时间"
           >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="请假时长/天" prop="leaveDuration">
          <el-input v-model="form.leaveDuration" placeholder="请输入请假时长" />
        </el-form-item>
        <el-form-item label="请假原因" prop="leaveReason">
          <el-input v-model="form.leaveReason" type="textarea" placeholder="请输入内容" />
        </el-form-item>

        <el-form-item label="申请人" prop="applyUserName">
          <el-input v-model="form.applyUserName" placeholder="请输入申请人" />
        </el-form-item>
        <el-form-item label="申请时间" prop="applyTime">
          <el-date-picker clearable
                          v-model="form.applyTime"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择申请时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <view-verify
        :open.sync="open"
        :row="row"
        :taskId="taskId"
        :type="type"

      />
    </el-dialog>
  </div>
</template>
<script>
import ViewVerify from "@/components/Activiti/ViewVerify/index";
import {getDicts} from "@/api/system/dict/data";

export  default {
  name:"leaveForm",
  components:{
    ViewVerify
  },
  props:{
    row: {
      type: Object,
    },
    taskId: {
      type: String,
    },
    taskName: {
      type: String,
    },
    type: {
      type: String,
      default: 'none',
    },
  },
  data(){
    return{
      title: '查看请假详情',
      form: this.row,
      open: false,
      // 请假类型字典
      typeOptions: [],
      // 表单校验
      rules: {


      },
      //  请假类型
      leaveTYpeOptions:[],

    }
  },
  created() {
    this.getleaveOption()
  },
  methods:{
    //获取请假类型
    getleaveOption(){
      getDicts("leave_type").then(res=>{
        this.leaveTYpeOptions=res.data
      })
    },
  }
}
</script>
